package com.huawei.userservice.mapper;

import com.huawei.userservice.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    //1 根据用户名查询用户
    @Select("select * from user where username=#{username}")
    User findByUsername(String username);

    //2 添加用户
    @Insert("insert into user(username,password,create_time,update_time) values(#{username},#{password},now(),now())")
    void add(@Param("username") String username,@Param("password") String password);
}
